<?php

  class PiankuAction extends CommonAction{
  
    public function index(){
	
	
	  $re=$this->page('pianku',10,'id desc');
	  
	  $i=-1;
	  
	  foreach($re as $v){
	   $i++;
	   
	   $user=M('suser')->where('id="%s"',$v['uid'])->field('username')->find();
	   
	   $re[$i]['username']=$user['username'];
	   
	   if($v['uid']==""){
	   
	     $d=M('dailiuser')->where('id="%s"',$v['dailiid'])->find();
	   
	     $re[$i]['username']=$d['username'];
	   }
	   
	  
	  
	  }
	  
	  
	  $this->re=$re;
	
	  $this->display();
	
	}
  
  
    public function del(){
	
	
	  $this->ajaxReturn((M('pianku')->where('id="%s"',$_POST['id'])->delete())?1:2);
	
	}
	
	public function big(){
	
	  $this->re=M('pianku')->where('id="%s"',$_GET['id'])->find();
	  
	  layout(false);
	  
	  $this->display();
	
	}
  
  
  }